home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / utmisc1 / fscode.lha / Src / FSCode.h < prev    next >
C/C++ Source or Header  |  1995-11-13  |  2KB  |  85 lines

  1. /*
  2. ** $VER: FSCode.h (22.5.95) by Flavio Stanchina
  3. */
  4.  
  5. #ifndef FSCODE_H
  6. #define FSCODE_H
  7.  
  8. #include <exec/types.h>
  9. #include <dos/dos.h>
  10.  
  11. /***** Strings *****/
  12. GLOBAL TEXT StartFmt[];
  13. GLOBAL TEXT MultiFmt[];
  14. GLOBAL TEXT   EndFmt[];
  15. GLOBAL TEXT  NameFmt[];
  16.  
  17. #define START_SKIP 7
  18.  
  19. /***** Structures *****/
  20. #define FSD_BUFSIZ 16384
  21.  
  22. struct FSData
  23. {
  24.     /* Command line parameters */
  25.     STRPTR  File;
  26.     STRPTR  To;
  27.     LONG    Encode;
  28.     LONG    Multi;
  29.     LONG  *pLines;
  30.  
  31.     /* Libraries */
  32.     struct Library    *UtilityBase;
  33.     struct DosLibrary *DOSBase;
  34.  
  35.     /* Files */
  36.     BPTR StdErr;
  37.     BPTR In, Out;
  38.     LONG close_out;
  39.     TEXT Name[256]; // name of file to (en/de)code
  40.  
  41.     /* Some data */
  42.     ULONG Size, RealSize;
  43.     ULONG CRC,  RealCRC;
  44.  
  45.     /* Multi (en/de)code */
  46.     ULONG NumFound; // [decode] number of encoded files found so far
  47.     ULONG PhysPart; // [decode] physical part
  48.     ULONG Part, Parts; // logical part/parts
  49.     ULONG Line, Lines; // [encode] current line and number of lines per part
  50.  
  51.     /* Buffers */
  52.     UBYTE  Buffer[FSD_BUFSIZ];
  53.     UBYTE *BufPtr; // ptr to current position in output buffer
  54.     ULONG  BufCnt; // bytes available/placed in the buffer
  55.  
  56.     UBYTE Temp[256]; // small buffer for whatever
  57.     ULONG TempCnt;
  58. };
  59.  
  60. #define UtilityBase (fsd->UtilityBase)
  61. #define DOSBase     (fsd->DOSBase)
  62.  
  63. /***** Prototypes *****/
  64. LONG FileSizeFH  (struct FSData *, BPTR);
  65. VOID MyPrintFault(struct FSData *, LONG, STRPTR);
  66. BOOL MyClose     (struct FSData *, BPTR);
  67.  
  68. LONG GetDec  (STRPTR *);
  69. LONG GetHex  (STRPTR *);
  70. VOID TrimLine(STRPTR *);
  71.  
  72. LONG Encode(struct FSData *);
  73. LONG Decode(struct FSData *);
  74.  
  75. BPTR  OpenPart(struct FSData *);
  76. LONG ClosePart(struct FSData *, LONG c);
  77. LONG FlushPart(struct FSData *);
  78.  
  79. __asm void stuff(void); // required by RawDoFmt() - parameters don't matter
  80.  
  81. #define VSPrintf(buf, fmt, args) RawDoFmt(fmt, args, stuff, buf);
  82. VOID SPrintf(STRPTR buf, STRPTR fmt, ...);
  83.  
  84. #endif
  85.